02. Learning by Example
Learning by Example
Below, you'll see two versions of an HTML document along with each version’s resulting web page.
In this scenario, both rendered pages have the same appearance, but if you look at the HTML code for each version, you'll notice a structural difference. See if you can identify this difference.
Example 1:
Example 1
Example 2:
Example 2. What does this HTML include that Example 1 lacks?
Providing Structure through <div>s
The difference between Example 1 and Example 2 is the presence of <div>s in the HTML code. Notice how the <div>s in Example 2 provide structure by grouping related content. Including <div>s in an HTML document can also make code easier to modify in the future. In the next section, you'll discover how CSS makes use of this structured HTML.